/* eslint-disable */
const { resolve, dirname } = require('path');
HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const AddAssetHtmlWebpackPlugin = require('add-asset-html-webpack-plugin');

module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'js/[name].[contenthash:10].js',
        path: resolve(__dirname, 'build'),
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
            minify: {
                collapseWhitespace: true,
                removeComments: true,
            },
        }),
        //告诉webpack那些库不参与打包，同时使用名称也需要改
        new webpack.DllReferencePlugin({
            manifest: resolve(__dirname, 'dll/manifest.json'), //输出文件名称
        }),
        //将某个文件打包输出出去，并在html自动引入
        new AddAssetHtmlWebpackPlugin({
            filepath: resolve(__dirname, 'dll/jquery.js'),
        }),
    ],
    mode: 'production',
};
